﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AAA.Forms.Components
{
    public partial class InputBox : Form
    {
        
        public InputBox()
        {
            InitializeComponent();
        }

        public string Message
        {
            get
            {
                return txtMessage.Text;
            }

            private set
            {
                txtMessage.Text = value;
            }

        }

        public DialogResult ShowInputDialog(string strTitle)
        {
            return ShowInputDialog(strTitle, "請輸入");
        }

        public DialogResult ShowInputDialog(string strTitle, string strCaption)
        {
            return ShowInputDialog(strTitle, strCaption, "");
        }

        public DialogResult ShowInputDialog(string strTitle, string strCaption, string strDefaultValue)
        {
            return ShowInputDialog(strTitle, strCaption, strDefaultValue, null);
        }
        public DialogResult ShowInputDialog(string strTitle, string strCaption, string strDefaultValue, string strMask)
        {
            //InputBox inputBox = new InputBox();
            Text = strCaption;
            lblTitle.Text = strTitle;
            
            if (strMask != null)
                txtMessage.Mask = strMask;
            txtMessage.Text = strDefaultValue;            

            DialogResult result = ShowDialog();
            return result;

        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            Message = txtMessage.Text;
        }
    }
}
